<?php

    public function get_info()
    {
        $year = 2030;
        $animals = array('鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪'); 
        $new_data = [];
        $new_info = [];
        for($i = 1949;$i <= $year;$i++){
            $sui = ($year - $i);
            $key = ($i - 1900) % 12;  
            $new_info[] = [
                'year'=>$i,
                'xiao'=>$animals[$key],
                'age'=>$sui,
            ];
            
            $new_data[] = $i.'--'.$animals[$key].'--'.$sui.'--'.($sui+1);
        }

        // $arr1 = $request->input('arr1');
        // $arr2 = $request->input('arr2');
        // $arr3 = $request->input('arr3');
        // $arr4 = $request->input('arr4');
        $arr1 = '1,2,3,4,5,6,7';
        $arr2 = '7,8,9,4,5,6,1';
        $arr3 = '5,6,4,2,3,7,8';
        $arr4 = '5,9,6,4,2,3,7';

        $all = $arr1.','.$arr2.','.$arr3.','.$arr4;
        $new_arr2 = [];
        $all = explode(',',$all);
        $count = array_count_values($all);//统计每个元素的出现次数
        $is_max = max($count);//找出数组中最大的值
        foreach($count as $ks=>$vs){
            if($vs == $is_max){
                $new_arr2[$ks] = $vs;
            }
        }
        $new_arr3 = [];
        foreach($new_arr2 as $kx =>$vx){
            foreach($new_info as $k=>$v){
                if($v['age'] == $kx){
                    $new_arr3[] = $v;
                }
            }
        }
        return ['data'=>$new_arr3];
    }